/**
 * 整理字典下拉框数据
 * @param dataList
 * @returns {[]}
 */
export function getDistList(dataList) {
  const newDataList = [];
  if (dataList != null) {
    let entityDefault = {"value":"","label":"全部"};
    newDataList.push(entityDefault)
    for (let index = 0; index < dataList.length; index++) {
      let dataType = dataList[index];
      if (dataType != null) {
        let entity = {"value": dataType.value, "label": dataType.name};
        newDataList.push(entity);
      }
    }
  }
return newDataList
}

/**
 * 整理字典下拉框数据
 * @param dataList
 * @returns {[]}
 */
export function getDataList(studentTypeList,defLabelName,valueName,labelName) {
  const dataList = [];
  if (studentTypeList != null) {
    let entityDefault = {"value": "", "label": defLabelName};
    dataList.push(entityDefault)

    for (let index = 0; index < studentTypeList.length; index++) {
      let data = studentTypeList[index];
      if (data != null) {
        //data[valueName] = data.id data[labelName] == data.studentName
        let entity = {"value": data[valueName], "label": data[labelName]};
        dataList.push(entity);
      }
    }
  }
  return dataList
}


export default {
  getDistList,
  getDataList
}
